home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / powervww / options.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-05  |  15.5 KB  |  402 lines

  1. //  ____________________________________________________
  2. // |                                                    |
  3. // |  Project:     POWER VIEW IDE                       |
  4. // |  File:        OPTIONS.H                            |
  5. // |  Compiler:    WPP386 (10.6)                        |
  6. // |                                                    |
  7. // |  Subject:     Options Manager interface            |
  8. // |                                                    |
  9. // |  Author:      Emil Dotchevski                      |
  10. // |____________________________________________________|
  11. //
  12. // E-mail: zajo@geocities.com
  13. // URL:    http://www.geocities.com/SiliconValley/Bay/3577
  14.  
  15. #ifndef _OPTIONS_H_INCLUDED
  16. #define _OPTIONS_H_INCLUDED
  17.  
  18.   #define MAX_TOOLS       16
  19.   #define MAX_FILE_PARAMS 8192
  20.  
  21. /*
  22. COMPILER OPTIONS DEFINES
  23. */
  24.   //memory models
  25.   #define mmSMALL                1
  26.   #define mmMEDIUM               2
  27.   #define mmCOMPACT              3
  28.   #define mmLARGE                4
  29.   #define mmFLAT_HUGE            5
  30.   //target cpu
  31.   #define cp8086                 1
  32.   #define cp80186                2
  33.   #define cp80286                3
  34.   #define cp80386                4
  35.   #define cp80486                5
  36.   #define cp80586                6
  37.   //code size
  38.   #define cs16BITS               1
  39.   #define cs32BITS               2
  40.   //calling conventions
  41.   #define ccREGISTER             1
  42.   #define ccSTACK                2
  43.   //compiler options
  44.   #define opPRECOMPILE      0x0001 //precompiled headers
  45.   #define opSIGNED_CHARS    0x0002 //signed characters
  46.   #define opENUMS_AS_INTS   0x0004 //treat enums as ints
  47.   #define opUNIQUE          0x0008 //all functions must have unique addresses
  48.   #define opBASE_TYPES      0x0010 //generate function prototypes using base types
  49.   #define opCALLS2GROW      0x0020 //generate calls to grow the stack
  50.   #define opNULLVALID       0x0040 //null points to valid memory
  51.   #define opOUTPUTDECL      0x0080 //output declarations to .def
  52.   #define opINTARGS         0x0100 //promote to int all function args & returns
  53.   #define opLITERALSINCODE  0x0200 //place literals in code segment
  54.   #define opSEPARATESEG     0x0400 //each function in separate segment
  55.   #define opSAVESEGS        0x0800 //save segment regs accross calls
  56.   #define opSYNTAXONLY      0x1000 //syntax check only
  57.   #define opTOUCHSTACK      0x2000 //touch the stack through SS first
  58.   #define opDEBUG_INFO      0x4000 //enable debugging information
  59.   #define opOPTIMIZATIONS   0x8000 //enable optimizations
  60.   //compiler optimizations
  61.   #define opLOOP            0x0001 //loop optimizations
  62.   #define opLOOPUNROLL      0x0002 //loop unrolling optimizations
  63.   #define opREORDER         0x0004 //reorder instructions for best pipeline usage
  64.   #define opCALLRET         0x0008 //call followed by <return> --> <jump>
  65.   #define opRELAX           0x0010 //relax aliasing constraints
  66.   #define opNUMERICALLY     0x0020 //numerically unstable optimizations
  67.   #define opLOWMEM          0x0040 //continue optimizaton if low on memory
  68.   #define opINLINE          0x0080 //inline code for math functions
  69.   #define opCONSISTENT      0x0100 //consistend floating point results
  70.   #define opPENTIUM         0x0200 //optimize floating point for Pentium
  71.   #define opINTRINSIC       0x0400 //expand intrinsic functions inline
  72.   #define opUSER            0x0800 //expand user functions inline
  73.   #define opMULTI_THREAD    0x1000 //OPTION, NOT AN OPTIMIZATION
  74.   #define opDLL             0x2000 //OPTION, NOT AN OPTIMIZATION
  75.   #define opDEFAULT_WIN     0x4000 //OPTION, NOT AN OPTIMIZATION
  76.   #define alBYTE                 1 //byte alignment
  77.   #define alWORD                 2 //word alignment
  78.   #define alDWORD                3 //dword alignment
  79.   #define alQWORD                4 //qword alignment
  80.   #define ofSPEED                1 //optimize for speed
  81.   #define ofSIZE                 2 //optimize for size
  82.   #define ofEFFECTIVITY          3 //optimize for effectivity
  83.   //segments
  84.   #define dsFLOATS               1 //DS floats, e.g. not fixed to DGROUP
  85.   #define dsPEGGED               2 //DS is pegged to DGROUP
  86.   #define dsLOAD                 3 //load DS directly from DGROUP
  87.   #define fsPEGGED          0x0001 //FS pegged to a segment
  88.   #define gsPEGGED          0x0002 //GS pegged to a segment
  89.   #define ssNEQDGROUP       0x0004 //SS != DGROUP
  90.   //floating point instructions
  91.   #define fpCALLS                1 //calls to floating point library
  92.   #define fpEMULATION            2 //inline 80x87 instructions w/ emulation
  93.   #define fpINLINE               3 //inline 80x87 instructions w/o emulation
  94.   #define fp8087                 1 //8087 floating point instructions
  95.   #define fp80287                2 //80287 floating point instructions
  96.   #define fp80387                3 //80387 floating point instructions
  97.   //debugging
  98.   #define doSTACK           0x0001 //stack overflow checks
  99.   #define doOPTIMIZATIONS   0x0002 //disable optimizations
  100.   #define doBROWSING        0x0004 //generate browsing info
  101.   #define doWARN_IS_ERR     0x0008 //treat warnings as errors
  102.   #define sfNEED                 1 //generate traceable stack frames as needed
  103.   #define sfALWAYS               2 //always generate traceable stack frames
  104.   #define dlLINENUMS             1 //line numbers debug info
  105.   #define dlFULL                 2 //full symbolic debug info
  106.   #define dlUNREFERENCED         3 //including unreferencet type names
  107.   #define dfWATCOM               1 //Watcom debug fomat
  108.   #define dfDWARF                2 //Dwarf debug fomat
  109.   #define dfCODEVIEW             3 //Codeview debug fomat
  110.   //exception handling
  111.   #define xhENABLE       0x0001
  112.   #define xhDIRECTCALL   1
  113.   #define xhTABLEDRIVEN  2
  114.   //preprocess files
  115.   #define pfENABLE          0x8000 //enable preprocessor
  116.   #define pfENCRYPT         0x0001 //encrypt identifiers
  117.   #define pfLINE            0x0002 //insert #line directives
  118.   #define pfPRESERVE        0x0004 //preserve comments
  119.   #define pfWRAP            0x0008 //wrap output
  120.   //portability
  121.   #define poANSI                 1 //true ANSI standard C++
  122.   #define poWATCOM               2 //enable Watcom C++ extensions
  123.  
  124.  
  125. /*
  126. LINKER OPTIONS DEFINES
  127. */
  128.   #define mfENABLE          0x0001 //enable map file
  129.   #define mfCOMPILER        0x0002 //compiler-generated symbols in the map
  130.   #define mfMANGLED         0x0004 //mangled names in the map
  131.   #define mfSTATIC          0x0008 //static symbols in the map
  132.   #define mfSEGMENT         0x0010 //segment info in the map
  133.  
  134.  
  135. /*
  136. EDITOR OPTIONS DEFINES
  137. */
  138.   #define efSAVE_STATUS     0x8000
  139.   #define efOPEN_INCLUDE    0x4000
  140.  
  141.  
  142. /*
  143. TOOLS ENTRY DEFINES
  144. */
  145.   #define teCOMPILER    0x0001 //this is a compiler
  146.   #define teTRAP_OUTPUT 0x0002 //trap output to a file
  147.   #define teTRAP_ERRORS 0x0004 //trap output & pass it to a filter program
  148.   #define teTRAP        (teTRAP_OUTPUT|teTRAP_ERRORS)
  149.   #define teDONT_SWAP   0x0008 //don't swap screen
  150.   #define tePROMPT      0x0010 //prompt with full command line before executing
  151.   #define teSAVE_ALL    0x0020 //save all files before executing
  152.   #define teSAVE_CUR    0x0040 //save current file before executing
  153.   #define teLONG_CMD    0x0080 //support long command lines
  154.   #define teMAKE        0x0100 //make project before executing
  155.  
  156.  
  157. /*
  158. STRUCTS
  159. */
  160.   #define BT_COUNT 7
  161.   struct Tbt
  162.   {
  163.     char *title;
  164.     char *key;
  165.   };
  166.  
  167.   #define TO_COUNT 26
  168.   struct Ttarget_os
  169.   {
  170.     char *title;
  171.     char *key;
  172.   };
  173.  
  174.   struct Tcompiler_options
  175.   {
  176.     int memory_model;           //mmSMALL..mmHUGE
  177.     int code_size;              //cs16BITS, cs32BITS
  178.     int cpu;                    //cp8086..cp80586
  179.     int calling_conventions;    //ccREGISTER, ccSTACK
  180.     uint build_target;
  181.     uint options;               //opXXXX
  182.     uint optimizations;         //opXXXX
  183.     int alignment;              //alBYTE, alWORD, alDWORD, alQWORD
  184.     int optimize_for;           //ofSPEED, ofSIZE, ofEFFECTIVITY
  185.     int ds_segment;             //dsFLOATS, dsPEGGED, dsLOAD
  186.     uint fsgsss_segments;       //fsPEGGED, gsPEGGED, ssNEQDGROUP
  187.     int fp_instructions;        //fpCALLS, fpEMULATION, fpINLINE
  188.     int fp_portability;         //fp8087, fp80287, fp80387
  189.     uint debug_options;         //doSTACK, doOPTIMIZATIONS, doBROWSING, doWARN_IS_ERR
  190.     int stack_frames;           //sfNEED, sfALWAYS
  191.     int debug_level;            //dlLINENUMS, dlFULL, dlUNREFERENCED;
  192.     int debug_format;           //dfWATCOM, dfDWARF, dfCODEVIEW
  193.     boolean exception_handling;
  194.     int destructions;           //xhDIRECTCALL, xhTABLEDRIVEN
  195.     uint preprocess_options;    //pfENCRYPT, pfLINE, pfPRESERVE, pfWRAP
  196.     int preprocess_wrap;        //wrap columns if wrap specified
  197.     int portability;            //poANSI, poWATCOM
  198.     long far_data_threshold;
  199.     int inline_threshold;
  200.     char warn_level;
  201.     char max_errors;
  202.     char defines[128];          //pre-compile defines
  203.     char other[128];            //additional (user-specified) options
  204.     char code_group_name[33];
  205.     char code_class_name[33];
  206.     char data_segment_name[33];
  207.     char module_name[33];
  208.     char text_segment_name[33];
  209.   };
  210.  
  211.   struct Tlinker_options
  212.   {
  213.     long stack_size;
  214.     char max_errors;
  215.     uint target_os;
  216.     char other_options[1024];   //memo-handled options
  217.   };
  218.  
  219.   struct Teditor_options
  220.   {
  221.     uint flags;
  222.     int condense_column;
  223.     int condense_length;
  224.     int  tab_size;
  225.     char extension[_MAX_EXT];
  226.     char cpp_extensions[10*5+1];
  227.     char asm_extensions[10*5+1];
  228.   };
  229.  
  230.   struct Tdefault_directories
  231.   {
  232.     char include  [_MAX_PATH];
  233.     char library  [_MAX_PATH];
  234.     char objects  [_MAX_PATH];
  235.     char tmp_files[_MAX_PATH];
  236.   };
  237.  
  238.   struct Ttools_entry
  239.   {
  240.     char path[_MAX_PATH];
  241.     char command_line[128];
  242.     uint shortcut;
  243.     uint options;
  244.     char trap_file[13];
  245.     char title[21];
  246.   };
  247.   #define TTOOLS_ENTRY_SIZE ( sizeof( Ttools_entry ) - 21 )
  248.  
  249. #endif //_OPTIONS_H_INCLUDED
  250.  
  251.  
  252. #ifdef _DECLARE_OPTIONS_H
  253.  
  254.   Tbt build_target[BT_COUNT] =
  255.   {
  256.     { "Host",       ""        },
  257.     { "DOS",        "dos"     },
  258.     { "Windows",    "windows" },
  259.     { "Windows NT", "nt"      },
  260.     { "OS/2",       "os2"     },
  261.     { "QNX",        "qnx"     },
  262.     { "Netware",    "netware" }
  263.   };
  264.  
  265.   Ttarget_os target_os[TO_COUNT] =
  266.   {
  267.     { "none",                                ""            },
  268.     { "16-bit DOS",                          "dos"         },
  269.     { "16-bit DOS COM",                      "com"         },
  270.     { "16-bit OS/2",                         "os2"         },
  271.     { "16-bit OS/2 DLL",                     "os2 dll"     },
  272.     { "16-bit QNX",                          "qnx"         },
  273.     { "16-bit Windows 3.x",                  "windows"     },
  274.     { "16-bit Windows 3.x DLL",              "windows_dll" },
  275.     { "32-bit AutoCAD Development System",   "ads"         },
  276.     { "32-bit AutoCAD Device Interface",     "eadi"        },
  277.     { "32-bit DOS/4GW",                      "dos4g"       },
  278.     { "32-bit PMODE/W",                      "pmodew"      },
  279.     { "32-bit FlashTek",                     "x32r"        },
  280.     { "32-bit Novell NLM",                   "netware"     },
  281.     { "32-bit OS/2",                         "os2v2"       },
  282.     { "32-bit OS/2 DLL",                     "os2v2 dll"   },
  283.     { "32-bit OS/2 Presentation Manager",    "os2v2_pm"    },
  284.     { "32-bit Phar Lap",                     "pharlap"     },
  285.     { "32-bit Phar Lap TNT",                 "tnt"         },
  286.     { "32-bit QNX",                          "qnx386"      },
  287.     { "32-bit Extended Windows 3.x EXE/DLL", "win386"      },
  288.     { "32-bit Windows 95",                   "win95"       },
  289.     { "32-bit Windows 95 DLL",               "win95 dll"   },
  290.     { "32-bit Windows NT Character-mode",    "nt"          },
  291.     { "32-bit Windows NT Windowed",          "nt_win"      },
  292.     { "32-bit Windows NT DLL",               "nt_dll"      }
  293.   };
  294.  
  295.   Tcompiler_options compiler_options =
  296.   {
  297.   /* memory_model        = */ mmFLAT_HUGE,
  298.   /* code_size           = */ cs32BITS,
  299.   /* cpu                 = */ cp80586,
  300.   /* calling_conventions = */ ccREGISTER,
  301.   /* build_target        = */ 0,
  302.   /* options             = */ 0,
  303.   /* optimizations       = */ opLOOP|opREORDER|opCALLRET|opRELAX|opNUMERICALLY|opPENTIUM|opINTRINSIC,
  304.   /* alignment           = */ alBYTE,
  305.   /* optimize_for        = */ ofSPEED,
  306.   /* ds_segment          = */ dsPEGGED,
  307.   /* fsgsss_segments     = */ 0,
  308.   /* fp_instructions     = */ fpEMULATION,
  309.   /* fp_portability      = */ fp80387,
  310.   /* debug_options       = */ doSTACK|doOPTIMIZATIONS,
  311.   /* stack_frames        = */ sfNEED,
  312.   /* debug_level         = */ dlFULL,
  313.   /* debug_format        = */ dfWATCOM,
  314.   /* exception_handling  = */ 0,
  315.   /* destructions        = */ xhDIRECTCALL,
  316.   /* preprocess_options  = */ 0,
  317.   /* preprocess_wrap     = */ 0,
  318.   /* portability         = */ poWATCOM,
  319.   /* far_data_threshold  = */ 32767,
  320.   /* inline_threshold    = */ 10,
  321.   /* warn_level          = */ 2,
  322.   /* max_errors          = */ 20,
  323.   /* defines             = */ { 0 },
  324.   /* other               = */ { 0 },
  325.   /* code_group_name     = */ { '*', 0 },
  326.   /* code_class_name     = */ { '*', 0 },
  327.   /* data_segment_name   = */ { '*', 0 },
  328.   /* module_name         = */ { '*', 0 },
  329.   /* text_segment_name   = */ { '*', 0 }
  330.   };
  331.  
  332.   Tlinker_options linker_options =
  333.   {
  334.   /* stack_size          = */ 4096,
  335.   /* max_erors           = */ 20,
  336.   /* target_os           = */ 10,
  337.   /* other_options       = */ "option eliminate"
  338.   };
  339.  
  340.   Teditor_options editor_options =
  341.   {
  342.   /* flags               = */ efAUTO_INDENT|efPROMPT_ON_REPLACE|efSAVE_STATUS|efOPEN_INCLUDE,
  343.   /* condense_column     = */ 0,
  344.   /* condense_length     = */ 3,
  345.   /* tab_size            = */ 8,
  346.   /* extension           = */ ".CPP",
  347.   /* cpp_extensions      = */ ".CPP;.C;.H",
  348.   /* asm_extensions      = */ ".ASM;.INC"
  349.   };
  350.  
  351.   Tdefault_directories default_directories =
  352.   {
  353.   /* include             = */ { 0 },
  354.   /* library             = */ { 0 },
  355.   /* objects             = */ { 0 },
  356.   /* tmp_files           = */ { 0 }
  357.   };
  358.  
  359.   boolean options_changed = 0;
  360.   Tlb_list *ot_tools = NULL;
  361.   char options_filename[_MAX_PATH] = "";
  362.   char short_options_filename[21] = "";
  363.  
  364. #else
  365.  
  366.   extern Tbt build_target[BT_COUNT];
  367.   extern Ttarget_os target_os[TO_COUNT];
  368.   extern Tcompiler_options compiler_options;
  369.   extern Tlinker_options linker_options;
  370.   extern Teditor_options editor_options;
  371.   extern Tdefault_directories default_directories;
  372.   extern boolean options_changed;
  373.   extern Tlb_list *ot_tools;
  374.   extern char options_filename[_MAX_PATH];
  375.   extern char short_options_filename[21];
  376.  
  377. #endif
  378.  
  379. void options_fast( void );
  380. void options_compiler_code_generation( void );
  381. void options_compiler_advanced_code_generation( void );
  382. void options_compiler_target( void );
  383. void options_compiler_segment_registers( void );
  384. void options_compiler_floating_point( void );
  385. void options_compiler_debugging( void );
  386. void options_compiler_exceptions_handling( void );
  387. void options_compiler_optimizations( void );
  388. void options_compiler_messages( void );
  389. void options_compiler_preprocess_files( void );
  390. void options_compiler_names( void );
  391. void options_linker( void );
  392. void options_editor( void );
  393. void options_directories( void );
  394. void options_tools( void );
  395. void expand_command_line( char *command_line, char *file, char *result );
  396. int exec_tool( uint tool, char *file );
  397. void options_file_changed( char *filename );
  398. boolean load_options( char *filename, boolean show_error );
  399. void options_open( void );
  400. void options_save( void );
  401. void options_save_as( void );
  402.